﻿<%@ Page Title="" Language="C#" MasterPageFile="~/shop/MasterPage.master" AutoEventWireup="true" CodeFile="QueryGoods.aspx.cs" Inherits="admin_QueryGoods" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .auto-style5 {
            margin-left: 0px;
        margin-right: 0px;
    }
        .auto-style6 {
            text-align: left;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:SqlDataSource ID="sdsQueryGoods" runat="server" ConnectionString="<%$ ConnectionStrings:keshe2ConnectionString %>" SelectCommand="SELECT 商品.商品编号, 商品.商品名称, 商品.数量, 商品.图片, 商品.价格, 商品类型.名称 FROM 商品 INNER JOIN 商品类型 ON 商品.商品类型 = 商品类型.编号" DeleteCommand="DELETE FROM [商品] WHERE [商品编号] = @商品编号" InsertCommand="INSERT INTO [商品] ([商品编号], [商品名称], [数量], [图片], [价格], [商品类型]) VALUES (@商品编号, @商品名称, @数量, @图片, @价格, @商品类型)" OnSelecting="sdsQueryGoods_Selecting" UpdateCommand="UPDATE [商品] SET [商品名称] = @商品名称, [数量] = @数量, [图片] = @图片, [价格] = @价格, [商品类型] = @商品类型 WHERE [商品编号] = @商品编号">
        <DeleteParameters>
            <asp:Parameter Name="商品编号" Type="String" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="商品编号" Type="String" />
            <asp:Parameter Name="商品名称" Type="String" />
            <asp:Parameter Name="数量" Type="Int32" />
            <asp:Parameter Name="图片" Type="String" />
            <asp:Parameter Name="价格" Type="Double" />
            <asp:Parameter Name="商品类型" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="商品名称" Type="String" />
            <asp:Parameter Name="数量" Type="Int32" />
            <asp:Parameter Name="图片" Type="String" />
            <asp:Parameter Name="价格" Type="Double" />
            <asp:Parameter Name="商品类型" Type="String" />
            <asp:Parameter Name="商品编号" Type="String" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <div class="auto-style6">
        <asp:Label ID="Label2" runat="server" Text="    查询类别："></asp:Label>
        <asp:DropDownList ID="DropDownList2" runat="server">
            <asp:ListItem Value="商品编号"></asp:ListItem>
            <asp:ListItem>商品名称</asp:ListItem>
        </asp:DropDownList>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:Button ID="btnQuery" runat="server" OnClick="btnQuery_Click" Text="查询" />
        <br />
    <asp:GridView ID="GridView1" runat="server" CellPadding="4" DataSourceID="sdsQueryGoods" ForeColor="#333333" GridLines="None" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" CssClass="auto-style5" DataKeyNames="商品编号" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" Width="1071px" Height="340px">
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        <Columns>
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
            <asp:BoundField DataField="商品编号" HeaderText="商品编号" ReadOnly="True" SortExpression="商品编号" />
            <asp:BoundField DataField="商品名称" HeaderText="商品名称" SortExpression="商品名称" />
            <asp:BoundField DataField="数量" HeaderText="数量" SortExpression="数量" />
            <asp:BoundField DataField="图片" HeaderText="图片" SortExpression="图片" Visible="False" >
            <ItemStyle Width="100px" />
            </asp:BoundField>
            <asp:BoundField DataField="价格" HeaderText="价格" SortExpression="价格" />
            <asp:BoundField DataField="名称" HeaderText="商品类型" SortExpression="商品类型" ReadOnly="True" />

            <asp:TemplateField HeaderText="商品类型" Visible="False">
                     <EditItemTemplate>
                         <asp:DropDownList ID="DropDownList1" runat="server" Width="151px"></asp:DropDownList>
                     </EditItemTemplate>
                     <ItemTemplate>
                         <asp:Label ID="Label1" runat="server" ></asp:Label>
                     </ItemTemplate>                
            </asp:TemplateField>



            <asp:ImageField DataImageUrlField="图片" HeaderText="商品图片">
                <ControlStyle Height="120px" Width="120px" />
            </asp:ImageField>
        </Columns>
        <EditRowStyle BackColor="#999999" />
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#E9E7E2" />
        <SortedAscendingHeaderStyle BackColor="#506C8C" />
        <SortedDescendingCellStyle BackColor="#FFFDF8" />
        <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
    </asp:GridView>
    </div>
</asp:Content>

